<template>
  <view>
    <van-cell-group>
      <van-field label="当前版本" input-align="right" :value="versionsValue" readonly />
    </van-cell-group>

    <van-cell title="意见反馈" is-link @click="onClickfeedback" /> 

    <van-cell title="关于我们" is-link @click="onClickAbout" />

    <view class="new_pet" v-if="isLogin">
      <button type="success" class="new_pet_button" @click="UpdateLogin">退出登录</button>
    </view>

    <!-- 弹框 -->
    <van-dialog use-slot title="你确定要退出登录？" showCancelButton :show="longinshow" @confirm="onLoginConfirm"
      @close="onLoginClose" confirm-button-color="#fc6538"></van-dialog>

  </view>
</template>

<script>
	import {
		VERSION
	} from '@/config/const'
  import {
    logoutUser
  } from '@/api/user.js'
  import {
    mapGetters,
    mapActions,
    mapState,
    mapMutations
  } from 'vuex'
  export default {
    data() {
      return {
        versionsValue: VERSION,
        longinshow: false
      };
    },
    computed: {
      ...mapGetters('m_user', ['isLogin'])
    },
    methods: {
      ...mapActions('m_user', ['LogOut']),
      ...mapMutations('m_pet', ['getStoresRecord']),
      UpdateLogin() {
        this.longinshow = true
      },
      onLoginConfirm() {
        // console.log('555')
        logoutUser().then(res => {
          // console.log(res)
          this.LogOut()
          this.getStoresRecord([])
          uni.navigateBack()
        }).catch(err => err)
      },
      onLoginClose(e) {
        this.longinshow = false
      },
      onClickAbout() {
        uni.navigateTo({
          url: '../about/about'
        })
      },
      onClickfeedback() {
        uni.navigateTo({
          url: '../feedback/feedback'
        })
      }
    }
  }
</script>

<style lang="scss">
  /deep/ .van-cell {
    padding-top: 40rpx !important;
    padding-bottom: 40rpx !important;
    align-items: center;

    /deep/ .van-cell__title {
      font-size: 34rpx;
      line-height: 64rpx;
    }
  }

  /deep/ .van-dialog__header {
    padding: 120rpx 0px !important;
  }

  .new_pet {
    position: fixed;
    bottom: 0;
    padding: 24rpx;
    width: 750rpx;
    height: 128rpx;
    box-sizing: border-box;
    background-color: #fff;

    .new_pet_button {
      width: 702rpx;
      height: 82rpx;
      background-color: #FDD338;
      border-radius: 6px;
      color: rgba(61, 61, 61, 1);
      line-height: 82rpx;
      border-radius: 82rpx;
      font-size: 16px;
      font-weight: 500;
    }
  }
</style>
